import Api from 'api';
import bffApi from 'fetch';

class WebApi {
    queryOrderList = (params = {})=>Api({
        url: 'order/list',
        method: 'POST',
        body: Object.assign({}, params)
    });


    startExportOrder = (params = {})=>Api({
        url: 'order/export/start',
        method: 'POST',
        body: Object.assign({}, params)
    });

    queryExport = (exportId = '')=>Api({
        url: `order/export/pull/${exportId}`,
        method: 'GET',
    });


    downloadOrder = (exportId = '')=>Api({
        url: `order/export/download/${exportId}`,
        method: 'GET',
    });

    queryShipCompanys = (params = {})=>Api({
        url: 'order/shipCompany/list',
        method: 'POST',
        body: Object.assign({}, params)
    });


    deliveryOrder = (params = {})=>Api({
        url: 'order/deliveryTrade',
        method: 'POST',
        body: Object.assign({}, params)
    });

    cartConfirmCheck = (params)=>bffApi('/trade/cartConfirmCheck', 'POST', params)

    getToken = (userId = '')=>Api({
        url: `token/${userId}`,
        method: 'POST',
        body: {}
    })

    cancelOrder = (tid = '')=>Api({
        url: `order/cancel/${tid}`,
        method: 'POST',
        body: {}
    })


    refundBefore = (tid = '')=>Api({
        url: `order/refund/${tid}`,
        method: 'GET'
    })

    refund = (params = {})=>Api({
        url: 'order/refund',
        method: 'POST',
        body: Object.assign({}, params)
    })

}

export default new WebApi();